import request from '@/config/request.js'
import { i18n } from '@/main'

/**
 * 客户账号密码登录
 * @param {Object} params
 * @property {string} username 账号
 * @property {string} password 密码
 * @returns
 */
export const getLogin = (params) =>
  request.post('/customer/accountLogin', params, {
    custom: { auth: false, toastMsg: i18n.t('login.loginFail') }
  })

// 用户退出
export const logout = () => request.get('/user/logou')

/**
 *  快捷登录
 * @param { Object } params
 * @property {string} code 小程序API授权的code
 * @returns
 */
export const quickLogin = (params) =>
  request.get('/customer/login', params, { custom: { auth: false } })
